package com.dkakunsi.monev.service;

import java.util.ArrayList;
import java.util.List;

import com.dkakunsi.monev.entity.MonevNameableEntity;
import com.dkakunsi.monev.util.MonevDataException;

public abstract class MonevAbstractService {
	@SuppressWarnings("unchecked")
	public List<MonevNameableEntity> toListMonevEntity(Object obj) throws MonevDataException {
		if(!(obj instanceof List<?>))
			throw new MonevDataException("Invalid Input");

		List<MonevNameableEntity> list = new ArrayList<>();
		for(MonevNameableEntity mv : (List<MonevNameableEntity>)obj) {
			list.add(mv);
		}
		
		return list;
	}
}
